package com.xdb.sqlparser.dialect.oracle.visitor;

import java.util.ArrayList;
import java.util.List;

import com.xdb.sqlparser.ast.SQLOrderBy;
import com.xdb.sqlparser.ast.expr.SQLBetweenExpr;
import com.xdb.sqlparser.ast.expr.SQLBinaryOpExpr;
import com.xdb.sqlparser.ast.expr.SQLInListExpr;
import com.xdb.sqlparser.ast.expr.SQLMethodInvokeExpr;
import com.xdb.sqlparser.ast.statement.SQLSelectGroupByClause;
import com.xdb.sqlparser.ast.statement.SQLSelectItem;
import com.xdb.sqlparser.util.ExportParameterVisitorUtils;
import com.xdb.sqlparser.visitor.SQLExportParameterVisitor;

public class OracleExportParameterVisitor extends OracleASTVisitorAdapter implements SQLExportParameterVisitor {

	private final List<Object> parameters;

	public OracleExportParameterVisitor() {
		this(new ArrayList<Object>());
	}

	public OracleExportParameterVisitor(List<Object> parameters) {
		this.parameters = parameters;
	}

	public List<Object> getParameters() {
		return parameters;
	}

	@Override
	public boolean visit(SQLSelectItem x) {
		return false;
	}

	@Override
	public boolean visit(SQLOrderBy x) {
		return false;
	}

	@Override
	public boolean visit(SQLSelectGroupByClause x) {
		return false;
	}

	@Override
	public boolean visit(SQLMethodInvokeExpr x) {
		ExportParameterVisitorUtils.exportParamterAndAccept(this.parameters, x.getParameters());

		return true;
	}

	@Override
	public boolean visit(SQLInListExpr x) {
		ExportParameterVisitorUtils.exportParamterAndAccept(this.parameters, x.getTargetList());

		return true;
	}

	@Override
	public boolean visit(SQLBetweenExpr x) {
		ExportParameterVisitorUtils.exportParameter(this.parameters, x);
		return true;
	}

	public boolean visit(SQLBinaryOpExpr x) {
		ExportParameterVisitorUtils.exportParameter(this.parameters, x);
		return true;
	}

}
